package com.dubboxml.gmail;

import com.alibaba.dubbo.common.URL;
import com.dubbo.gmail.api.message.RequestDubboFactory;
import com.dubbo.gmail.api.model.UserModel;
import com.dubbo.gmail.api.service.ReceiveHelloService;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class ProviderMain {
    public static void main(String[] args) throws Exception {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[]{"spring-common.xml"});
        context.start();
        System.in.read(); // 按任意键退出
//        URL url = new URL("dubbo" , "10.1.11.225", 20881);
//        ReceiveHelloService receiveHelloService = RequestDubboFactory.buildRequestDubbo(ReceiveHelloService.class, context, url);
//        ReceiveHelloService receiveHelloService = (ReceiveHelloService)context.getBean("receiveHelloService"); // 获取远程服务代理
//        System.out.println(receiveHelloService.receiveHelloService(new UserModel(11, "providerMain")));
//        System.in.read(); // 按任意键退出
    }
}
